{extend name="common:base" /}
{block name="css"}
<link rel="stylesheet" type="text/css" href="__JS__/editor/css/simditor.css" />
{/block}
{block name="body"}
<div class="layui-container fly-marginTop">
  <div class="fly-panel" pad20 style="padding-top: 5px;">
    <!--<div class="fly-none">没有权限</div>-->
    <div class="layui-form layui-form-pane">
      <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
          <li class="layui-this">发表新帖<!-- 编辑帖子 --></li>
        </ul>
        <div class="layui-form layui-tab-content" style="padding: 20px 0;">
          <div class="layui-tab-item layui-show">
            <form action="{:url('topic/add')}" method="post">
	        <input type="hidden" class="form-control" id="tid" name="tid" value="6">
		    <input type="hidden" name="attach" value="{$attach}" />
              <div class="layui-form-item">
                  <label class="layui-form-label">版块分类</label>
                  <div class="layui-input-inline">
                   <select lay-verify="required" name="cid">
                      <option value="">请选择版块</option>
                      {volist name="category_level_list" id="vo"}
                      <option value="{$vo.id}">{neq name="vo.level" value="1"}|{php}for($i=1;$i<$vo['level'];$i++){echo ' --';}{/php}{/neq} {$vo.name}</option>
                      {/volist}

                    </select>
                  </div>
              </div>
			 <div class="layui-form-item">
                  <label class="layui-form-label">标题</label>
                  <div class="layui-input-block">
                    <input type="text" name="title" required lay-verify="required" class="layui-input">
                  </div>
             </div>
              <div class="layui-form-item layui-form-text">
                <div class="layui-input-block">
                  <textarea id="editor" name="content" required lay-verify="" placeholder="详细描述" class="layui-textarea" autofocus></textarea>
                </div>
              </div>
                    {if (session('group_id')==1) or (session('group_id')==2)}
                    <div class="layui-form-item">
                        <label class="layui-form-label">置顶</label>
                        <div class="layui-input-block">
                            <input type="radio" name="is_top" value="0" title="未置顶" checked="checked">
                            <input type="radio" name="is_top" value="1" title="置顶">

                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">推荐</label>
                        <div class="layui-input-block">
                            <input type="radio" name="is_recommend" value="0" title="未推荐" checked="checked">
                            <input type="radio" name="is_recommend" value="1" title="推荐">
                        </div>
                    </div>
                    {/if}
              <div class="layui-form-item">
                <button class="layui-btn" lay-filter="*" lay-submit><i class="iconfont icon-yijianfankui"></i> 立即发布</button>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
{/block}
{block name="js"}
<script type="text/javascript" src="__JS__/editor/js/module.js"></script>
<script type="text/javascript" src="__JS__/editor/js/hotkeys.js"></script>
<script type="text/javascript" src="__JS__/editor/js/uploader.js">
</script>
<script type="text/javascript" src="__JS__/editor/js/simditor.js"></script>
{/block}
{block name="script"}
<script type="text/javascript">
	$(function(){
	var editor = new Simditor({
	textarea: $('#editor'),
    toolbar: ['title', 'bold', 'italic', 'underline', 'strikethrough', 'color', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link', 'image', 'hr', '|', 'indent', 'outdent'],
    upload: {
        url: '/api.php/upload/attach.html',
        params:{attach:$("input[name='attach']").val()}, 
        fileKey: 'file', 
        connectionCount: 3,
        leaveConfirm: '正在上传文件',
    }
});
})
</script>
{/block}